package com.example.listener.test;/*
   
/**
* @program: demo
*
* @description: 实现上下文监听器
*
* @author: kk
*
* @create: 2020-02-10 10:52
**/

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@WebListener
public class MyServletContextListener implements ServletContextListener {
    @Override
   public  void contextInitialized(ServletContextEvent sce){
        System.out.println("自定义监听器：上下文的初始化。。。");
        System.out.println(sce.getServletContext().getServerInfo());
    }
    @Override
    public  void contextDestroyed(ServletContextEvent sce) {
        System.out.println("上下文销毁。。。");
    }
}
